#include <iostream>
#include "../comlink/link/link.h"
#include "../comlink/linkslist/linkslist.h"
#include "../comlink/linkcontrol/linkcontrol.h"
#include "../processor/processor.h"
#include "../multprocessor/multprocessor.h"
#include "../pixelimage/pixelimage.h"


int main(int argc, char ** argv)
{
  MultProcessor * processors;
  PixelImage * image;
  int ClockCycles = 0;

  image = new PixelImage(argv[1]);
  processors = image->GetLoadedImage();

  /* This start the actual processing */
  processors->PrintProcessorPixels();

  std::cout << std::endl;

  processors->PrintProcessorBuildLabels();

  std::cout << std::endl;

  while(!processors->AreAllProcessorsComplete())
  {
    ClockCycles++;

    for(int clock = 0; clock < 13; clock++)
    {
      processors->ClockAllProcessors();
    }
  }

  std::cout << std::endl;

  processors->PrintProcessorBuildLabels();

  std::cout << std::endl;

  std::cout << "Total Number of Clock Cycles: " << ClockCycles << std::endl;

  delete processors;

  return 1;
}
